const preSave = function (next) {
    if (this.isNew) {
        const ts = Date.now()
        this['meta'].createAt = ts
        this['meta'].updateAt = ts
    } else {
        this['meta'].updateAt = Date.now()
    }

    next()
}

module.exports = {
    preSave,
}
